﻿using System;
using UnityEngine;

public class ShowFPS : MonoBehaviour
{
    private float deltaTime;
    private GUIStyle style = new GUIStyle();

    private void Awake()
    {
        this.style.alignment = TextAnchor.UpperLeft;
        this.style.normal.textColor = Color.white;
        if (!Debug.isDebugBuild)
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }
    }

    private void OnGUI()
    {
        Rect position = new Rect(0f, 0f, (float) Screen.width, 20f);
        float num = 1f / this.deltaTime;
        string text = string.Format("{0:0.} fps", num);
        GUI.Label(position, text, this.style);
    }

    private void Update()
    {
        this.deltaTime += (Time.deltaTime - this.deltaTime) * 0.1f;
    }
}

